package Z11_4_synchronizedControl;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

/**
 * @author： pang-yun
 * @date： 2021-11-04 14:55
 * 功能目的 ：用于
 */

@Slf4j
public class ParkUnParkDemo {
    public static void main(String[] args) {
        Thread first = new Thread(() -> {
            LockSupport.park();  // 运行到这  挂起
            log.info("first!!!");
        }, "first");

        first.start();


        Thread second = new Thread(() -> {
            LockSupport.unpark(first); //  释放   permit +  1
            log.info("second!!!");
        }, "second");

        second.start();
    }
}
